package com.yangzb.neo4j;

import com.yangzb.neo4j.node.StudentNode;
import com.yangzb.neo4j.service.StudentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;

@Component
@Slf4j
public class Runner implements ApplicationRunner {
    @Resource
    StudentService studentService;


    @Override
    public void run(ApplicationArguments args){
        StudentNode yzb = new StudentNode().setName("小强");
        StudentNode linhui = new StudentNode().setName("小帅");
        StudentNode linhui = new StudentNode().setName("小帅");

        List<StudentNode> rel = new ArrayList<>();
        rel.add(linhui);
        yzb.setRel(rel);
        studentService.saveStudentNode(linhui);
        studentService.saveStudentNode(yzb);
    }
}

